package com.chen.wow.day02.javaconfig;


import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes=MyConfig.class)
public class TestMyConfig {
	@Autowired
	private CDPlayer cdPlayer;
	@Autowired
	private CDPlayer anotherCdPlayer;
	@Test
	public void play(){
		System.out.println(cdPlayer == anotherCdPlayer);//false
		System.out.println(cdPlayer.getCdone() == anotherCdPlayer.getCdone());//true
		Assert.assertEquals("cdone name", cdPlayer.getCdone().getName());
		cdPlayer.play();
	}
}
